import request from "@/utils/request";

const api_name = '/teacher'

export default {
    // 获取讲师列表数据
    getList(page, limit, searchObj) {
        return request({
            url: `${api_name}/list/${page}/${limit}`,
            method: 'post',
            data: searchObj
        })
    },
    // 根据id删除数据
    delList(id) {
        return request({
            url: `${api_name}/${id}`,
            method: 'delete'
        })
    },
    // 添加讲师
    addList(teacher) {
        return request({
            url: `${api_name}`,
            method: "post",
            data: teacher
        })
    },
    // 根据id查询讲师
    getListById(id) {
        return request({
            url: `${api_name}/${id}`,
            method: 'get',
        })
    },
    // 更新讲师数据
    updateList(teacher) {
        return request({
            url: `${api_name}/${teacher.id}`,
            method: 'put',
            data: teacher
        })
    },
    // 获取所有讲师数据
    getTeacherAll() {
        return request({
            url: `${api_name}/list`,
            method: 'get'
        })
    }
}